commonpopup.vue 10 KB

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