commonpopup.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <template>
  2. <view class="pop-container">
  3. <uni-popup ref="popup" type="dialog" >
  4. <uni-popup-dialog
  5. :title="title"
  6. message=""
  7. :duration="2000"
  8. :before-close="true"
  9. @close="handleCancel"
  10. @confirm="handleOk">
  11. <view class="dialog-content">
  12. <view class="header-container">
  13. <uni-row class="demo-uni-row">
  14. <uni-col :span="5" style="padding-left: 10px;text-align: center" >
  15. <view class="gjz-title">关键字</view>
  16. </uni-col>
  17. <uni-col :span="19">
  18. <uni-search-bar
  19. v-model="keyWord"
  20. @input="input"
  21. @cancel="cancel"
  22. @clear="clear"
  23. cancelButton="none"
  24. />
  25. </uni-col>
  26. </uni-row>
  27. <uni-row class="demo-uni-row">
  28. <uni-col :span="24" style="text-align: center;">
  29. <button class="mini-btn" type="primary" size="mini" @click="search">查询</button>
  30. </uni-col>
  31. </uni-row>
  32. </view>
  33. <view style="height: 200px;">
  34. <zb-table
  35. ref="zbTable"
  36. :show-header="true"
  37. :stripe="false"
  38. :columns="column"
  39. :data="data"
  40. :highlight="true"
  41. @currentChange="currentChange"
  42. :border="true"
  43. >
  44. </zb-table>
  45. </view>
  46. </view>
  47. <!-- <view slot="footer">
  48. <button type="primary" @click="handleOk">确定</button>
  49. <button @click="handleCancel">取消</button>
  50. </view> -->
  51. </uni-popup-dialog>
  52. </uni-popup>
  53. </view>
  54. </template>
  55. <script>
  56. import { getDicts } from "@/api/system/dict/data"; // 字典
  57. import { listBackTaskInBackStockIn, listStockIn, listTaskIn, listSupplier, listDepartment, listEmployee, listExtend } from "@/api/wms/backStockIn.js";
  58. export default {
  59. props: {
  60. title: {
  61. type: String,
  62. required: true
  63. },
  64. idxFlag:{
  65. type: String,
  66. required: true
  67. },
  68. formData:{
  69. type: Object,
  70. require: true
  71. }
  72. },
  73. mounted() {
  74. },
  75. created: function(option) {
  76. },
  77. data() {
  78. return {
  79. currentFlag: '',
  80. keyWord: '', // 输入查询的值
  81. column: [], // 表头数据
  82. data: [], // 表体数据
  83. currentSelectData: {}, //当前选中数据行
  84. };
  85. },
  86. methods:{
  87. handleOk() {
  88. let returnData = {
  89. currentFlag: this.currentFlag,
  90. selectData: this.currentSelectData
  91. }
  92. this.$emit("sendData", returnData);
  93. // 点击确定按钮的处理逻辑
  94. this.currentSelectData = {}
  95. this.$refs.popup.close()
  96. },
  97. handleCancel() {
  98. // 点击取消按钮的处理逻辑
  99. this.$refs.popup.close()
  100. },
  101. showPopup() {
  102. // 传递的哪个跳转标志位
  103. this.currentFlag = this.idxFlag;
  104. let that = this;
  105. let cFlag = that.idxFlag;
  106. switch (cFlag){
  107. case "rwbm": //任务编码
  108. // 入库类型
  109. let inTypeObj = {}
  110. getDicts("in_type").then(response => {
  111. // that.inTypeOption = response.data;
  112. let tmpArr = response.data;
  113. if(tmpArr.length > 0){
  114. tmpArr.forEach((item,index)=>{
  115. inTypeObj[item.dictValue] = item.dictLabel;
  116. })
  117. }
  118. });
  119. // 任务编码表头
  120. that.column = [
  121. { name: 'subTaskCode', label:'任务编号', width:170,align:'center', emptyString:'--' },
  122. { name: 'taskDate', label:'任务日期', width:140,align:'center', emptyString:'--'},
  123. ];
  124. that.getRwbmList();
  125. break;
  126. case "bm": // 部门
  127. // 部门表头
  128. that.column = [
  129. { name: 'deptCode', label:'部门编码', width:130,align:'center', emptyString:'--' },
  130. { name: 'deptName', label:'部门名称', width:120,align:'center', emptyString:'--'},
  131. ];
  132. that.getBmList();
  133. break;
  134. case "zy": // 职员
  135. // 职员表头
  136. that.column = [
  137. { name: 'employeeCode', label:'职员编码', width:120,align:'center', emptyString:'--' },
  138. { name: 'employeeName', label:'职员名称', width:100,align:'center', emptyString:'--'},
  139. ];
  140. that.getZyList();
  141. break;
  142. case "sflb": // 收发类别
  143. // 收发类别表头
  144. that.column = [
  145. { name: 'extendClassName', label:'类', width:60, align:'center', emptyString:'--' },
  146. { name: 'extendCode', label:'编码', width:100, align:'center', emptyString:'--'},
  147. { name: 'extendName', label: '名称', width:150, align:'center', emptyString:'--'},
  148. ];
  149. that.getSflbList();
  150. break;
  151. case "gys": // 供应商
  152. // 供应商表头
  153. that.column = [
  154. { name: 'supplierCode', label:'供应商码', width:120, align:'center', emptyString:'--' },
  155. { name: 'supplierName', label:'供应商', width:300, align:'center', emptyString:'--'},
  156. ];
  157. that.getGysList();
  158. break;
  159. default:
  160. break;
  161. }
  162. },
  163. hidePopup() {
  164. this.$refs.popup.close();
  165. },
  166. // 单选当前行
  167. currentChange(row,index){
  168. this.currentSelectData = row;
  169. },
  170. // searchBar
  171. input(value) {// uniSearchBar 的 value 改变时触发事件,返回参数为uniSearchBar的 value e=value
  172. this.keyWord = value;
  173. },
  174. clear(res) {
  175. this.keyWord = "";
  176. },
  177. cancel(res) {
  178. this.keyWord = "";
  179. },
  180. // 查询按钮点击事件
  181. search(){
  182. let that = this;
  183. let cFlag = that.currentFlag;
  184. switch (cFlag){
  185. case "rwbm": // 任务编码
  186. this.getRwbmList();
  187. break;
  188. case "bm": // 部门
  189. this.getBmList();
  190. break;
  191. case "zy": // 职员
  192. this.getZyList();
  193. break;
  194. case "sflb": //收发类别
  195. this.getSflbList();
  196. break;
  197. case "gys": //供应商
  198. this.getGysList();
  199. break;
  200. default:
  201. break;
  202. }
  203. },
  204. // 获取任务编码数据
  205. getRwbmList(){
  206. let that = this;
  207. let params = {
  208. taskType: "-1" , //(固定 -1是入库退)
  209. supplierCode: that.formData.supplierCode, //供应商 (为空时不传)
  210. billTypeCode:that.formData.taskBillTypeCode,
  211. params: {
  212. "keyWord":that.keyWord,
  213. "limit":50
  214. },
  215. }
  216. listBackTaskInBackStockIn(params).then(res => {
  217. if(res.code === 200){
  218. that.data = res.rows.map(item => {
  219. let a1 = item.wmsTaskIns;
  220. let a2 = item;
  221. return Object.assign({}, a2, a1);
  222. });
  223. //that.data = res.rows;
  224. this.$refs.popup.open();
  225. }
  226. });
  227. },
  228. // 获取供应商数据
  229. getGysList(){
  230. let that = this;
  231. let params = {
  232. status: '0', //(固定)
  233. params: {
  234. "keyWord":that.keyWord,
  235. "limit":50
  236. },
  237. }
  238. listSupplier(params).then(res => {
  239. if(res.code === 200){
  240. that.data = res.rows;
  241. this.$refs.popup.open();
  242. }
  243. });
  244. },
  245. // 获取部门数据
  246. getBmList(){
  247. let that = this;
  248. let params = {
  249. status: '0', //(固定)
  250. params: {
  251. "keyWord":that.keyWord,
  252. "limit":50
  253. },
  254. }
  255. listDepartment(params).then(res => {
  256. if(res.code === 200){
  257. that.data = res.rows;
  258. this.$refs.popup.open();
  259. }
  260. });
  261. },
  262. // 职员数据
  263. getZyList(){
  264. let that = this;
  265. if(that.formData.deptCode === ""){
  266. uni.showToast({
  267. title: "请先选择部门",
  268. icon: "none",
  269. })
  270. return;
  271. }
  272. let params = {
  273. status: '0', //(固定)
  274. deptCode: that.formData.deptCode,
  275. params: {
  276. "keyWord":that.keyWord,
  277. "limit":50
  278. },
  279. }
  280. listEmployee(params).then(res => {
  281. if(res.code === 200){
  282. that.data = res.rows;
  283. this.$refs.popup.open();
  284. }
  285. });
  286. },
  287. // 获取收发类别数据
  288. getSflbList(){
  289. let that = this;
  290. let params = {
  291. extendClassCode: "01.01",
  292. params: {
  293. "keyWord":that.keyWord,
  294. "limit":50
  295. },
  296. }
  297. listExtend(params).then(res => {
  298. if(res.code === 200){
  299. that.data = res.rows;
  300. this.$refs.popup.open();
  301. }
  302. });
  303. },
  304. getTpList(){
  305. },
  306. },
  307. }
  308. </script>
  309. <style>
  310. @import "@/static/scss/commonpopup.css"
  311. </style>