commonpopup.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  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 { listStockIn, ListStockOutHead, listBackStockTaskOut, listRwbm, listSupplier, listDepartment, listEmployee, listCustomer, listExtend, listPallet, listPackage } from "@/api/wms/backStockOut.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("out_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: 'taskCode', label:'任务编号', width:170,align:'center', emptyString:'--' },
  122. { name: 'taskDate', label:'任务日期', width:120,align:'center', emptyString:'--'},
  123. { name: 'taskType', label: '任务类型', width:100, align:'center', emptyString:'--', filters:inTypeObj},
  124. ];
  125. that.getRwbmList();
  126. break;
  127. case "bm": // 部门
  128. // 部门表头
  129. that.column = [
  130. { name: 'deptCode', label:'部门编码', width:130,align:'center', emptyString:'--' },
  131. { name: 'deptName', label:'部门名称', width:120,align:'center', emptyString:'--'},
  132. ];
  133. that.getBmList();
  134. break;
  135. case "zy": // 职员
  136. // 职员表头
  137. that.column = [
  138. { name: 'employeeCode', label:'职员编码', width:120,align:'center', emptyString:'--' },
  139. { name: 'employeeName', label:'职员名称', width:100,align:'center', emptyString:'--'},
  140. ];
  141. that.getZyList();
  142. break;
  143. case "kh": // 客户
  144. // 职员表头
  145. that.column = [
  146. { name: 'customerCode', label:'客户编码', width:100,align:'center', emptyString:'--' },
  147. { name: 'customerName', label:'客户名称', width:300,align:'center', emptyString:'--'},
  148. ];
  149. that.getKhList();
  150. break;
  151. case "sflb": // 收发类别
  152. // 收发类别表头
  153. that.column = [
  154. { name: 'extendClassName', label:'类', width:60, align:'center', emptyString:'--' },
  155. { name: 'extendCode', label:'编码', width:100, align:'center', emptyString:'--'},
  156. { name: 'extendName', label: '名称', width:150, align:'center', emptyString:'--'},
  157. ];
  158. that.getSflbList();
  159. break;
  160. case "gys": // 供应商
  161. // 供应商表头
  162. that.column = [
  163. { name: 'supplierCode', label:'供应商码', width:120, align:'center', emptyString:'--' },
  164. { name: 'supplierName', label:'供应商', width:300, align:'center', emptyString:'--'},
  165. ];
  166. that.getGysList();
  167. break;
  168. case "tp": // 托盘
  169. // 托盘表头
  170. that.column = [
  171. { name: 'palletCode', label:'托盘编码', width:100, align:'center', emptyString:'--'},
  172. { name: 'palletName', label: '托盘名称', width:130, align:'center', emptyString:'--'},
  173. ];
  174. that.getTpList();
  175. break;
  176. case "bz": // 包装
  177. // 包装表头
  178. that.column = [
  179. { name: 'packageCode', label:'包装编码', width:100, align:'center', emptyString:'--'},
  180. { name: 'packageName', label: '包装名称', width:130, align:'center', emptyString:'--'},
  181. ];
  182. that.getBzList();
  183. break;
  184. default:
  185. break;
  186. }
  187. },
  188. hidePopup() {
  189. this.$refs.popup.close();
  190. },
  191. // 单选当前行
  192. currentChange(row,index){
  193. this.currentSelectData = row;
  194. },
  195. // searchBar
  196. input(value) {// uniSearchBar 的 value 改变时触发事件,返回参数为uniSearchBar的 value e=value
  197. this.keyWord = value;
  198. },
  199. clear(res) {
  200. this.keyWord = "";
  201. },
  202. cancel(res) {
  203. this.keyWord = "";
  204. },
  205. // 查询按钮点击事件
  206. search(){
  207. let that = this;
  208. let cFlag = that.idxFlag;
  209. switch (cFlag){
  210. case "rwbm": // 任务编码
  211. this.getRwbmList();
  212. break;
  213. case "bm": // 部门
  214. that.getBmList();
  215. break;
  216. case "zy": // 职员
  217. this.getZyList();
  218. break;
  219. case "kh": // 职员
  220. this.getKhList();
  221. break;
  222. case "sflb": //收发类别
  223. this.getSflbList();
  224. break;
  225. case "gys": //供应商
  226. this.getGysList();
  227. break;
  228. case "bz": //包装
  229. this.getBzList();
  230. break;
  231. case "tp": //托盘
  232. this.getTpList();
  233. break;
  234. default:
  235. break;
  236. }
  237. },
  238. // 获取任务编码数据
  239. getRwbmList(){
  240. let that = this;
  241. let params = {
  242. supplierCode: that.formData.supplierCode, //供应商
  243. customerCode: that.formData.customerCode, //客户
  244. taskType: 1,
  245. params: {
  246. "billTypeCode":that.formData.billTypeCode,
  247. "keyWord":that.keyWord,
  248. "limit":50
  249. },
  250. }
  251. listBackStockTaskOut(params).then(res => {
  252. if(res.code === 200){
  253. that.data = res.rows.map(item => {
  254. let a1 = item.wmsTaskOuts;
  255. let a2 = item;
  256. return Object.assign({}, a2, a1);
  257. });
  258. this.$refs.popup.open();
  259. }
  260. });
  261. },
  262. // 获取供应商数据
  263. getGysList(){
  264. let that = this;
  265. let params = {
  266. status: '0', //(固定)
  267. params: {
  268. "keyWord":that.keyWord,
  269. "limit":50
  270. },
  271. }
  272. listSupplier(params).then(res => {
  273. if(res.code === 200){
  274. that.data = res.rows;
  275. this.$refs.popup.open();
  276. }
  277. });
  278. },
  279. // 获取部门数据
  280. getBmList(){
  281. let that = this;
  282. let params = {
  283. status: '0', //(固定)
  284. params: {
  285. "keyWord":that.keyWord,
  286. "limit":50
  287. },
  288. }
  289. listDepartment(params).then(res => {
  290. if(res.code === 200){
  291. that.data = res.rows;
  292. this.$refs.popup.open();
  293. }
  294. });
  295. },
  296. // 职员数据
  297. getZyList(){
  298. let that = this;
  299. if(that.formData.deptCode === ""){
  300. uni.showToast({
  301. title: "请先选择部门",
  302. icon: "none",
  303. })
  304. return;
  305. }
  306. let params = {
  307. status: '0', //(固定)
  308. deptCode: that.formData.deptCode,
  309. params: {
  310. "keyWord":that.keyWord,
  311. "limit":50
  312. },
  313. }
  314. listEmployee(params).then(res => {
  315. if(res.code === 200){
  316. that.data = res.rows;
  317. this.$refs.popup.open();
  318. }
  319. });
  320. },
  321. // 获取客户数据
  322. getKhList(){
  323. let that = this;
  324. let params = {
  325. status: '0', //(固定)
  326. params: {
  327. "keyWord":that.keyWord,
  328. "limit":50
  329. },
  330. }
  331. listCustomer(params).then(res => {
  332. if(res.code === 200){
  333. that.data = res.rows;
  334. this.$refs.popup.open();
  335. }
  336. });
  337. },
  338. // 获取收发类别数据
  339. getSflbList(){
  340. let that = this;
  341. let params = {
  342. extendClassCode: "01.02",
  343. params: {
  344. "keyWord":that.keyWord,
  345. "limit":50
  346. },
  347. }
  348. listExtend(params).then(res => {
  349. if(res.code === 200){
  350. that.data = res.rows;
  351. this.$refs.popup.open();
  352. }
  353. });
  354. },
  355. // 获取包装数据
  356. getBzList(){
  357. let that = this;
  358. let params = {
  359. status: '0',
  360. params: {
  361. "keyWord":that.keyWord,
  362. "limit":50
  363. },
  364. }
  365. listPackage(params).then(res => {
  366. if(res.code === 200){
  367. that.data = res.rows;
  368. this.$refs.popup.open();
  369. }
  370. });
  371. },
  372. //获取托盘数据
  373. getTpList(){
  374. let that = this;
  375. let params = {
  376. status: '0',
  377. params: {
  378. "keyWord":that.keyWord,
  379. "limit":50
  380. },
  381. }
  382. listPallet(params).then(res => {
  383. if(res.code === 200){
  384. that.data = res.rows;
  385. this.$refs.popup.open();
  386. }
  387. });
  388. },
  389. },
  390. }
  391. </script>
  392. <style>
  393. @import "@/static/scss/commonpopup.css"
  394. </style>