commonpopup.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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 { listStockCheck, listStockCheckHead, listTaskCheck, listRwbm, listSupplier, listDepartment, listEmployee, listExtend, listPallet, listPackage } from "@/api/wms/stockCheck.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 "tp": // 托盘
  145. // 托盘表头
  146. that.column = [
  147. { name: 'palletCode', label:'托盘编码', width:100, align:'center', emptyString:'--'},
  148. { name: 'palletName', label: '托盘名称', width:130, align:'center', emptyString:'--'},
  149. ];
  150. that.getTpList();
  151. break;
  152. case "bz": // 包装
  153. // 包装表头
  154. that.column = [
  155. { name: 'packageCode', label:'包装编码', width:100, align:'center', emptyString:'--'},
  156. { name: 'packageName', label: '包装名称', width:130, align:'center', emptyString:'--'},
  157. ];
  158. that.getBzList();
  159. break;
  160. case "stock": // 单据
  161. // 单据
  162. that.column = [
  163. { name: 'stockCode', label:'单据编号', width:150, align:'center', emptyString:'--'},
  164. { name: 'deptName', label: '部门', width:130, align:'center', emptyString:'--'},
  165. { name: 'rowCount', label: '行数', width:90, align:'center', emptyString:'--'},
  166. ];
  167. that.getStockList();
  168. break;
  169. default:
  170. break;
  171. }
  172. },
  173. hidePopup() {
  174. this.$refs.popup.close();
  175. },
  176. // 单选当前行
  177. currentChange(row,index){
  178. this.currentSelectData = row;
  179. },
  180. // searchBar
  181. input(value) {// uniSearchBar 的 value 改变时触发事件,返回参数为uniSearchBar的 value e=value
  182. this.keyWord = value;
  183. },
  184. clear(res) {
  185. this.keyWord = "";
  186. },
  187. cancel(res) {
  188. this.keyWord = "";
  189. },
  190. // 查询按钮点击事件
  191. search(){
  192. let that = this;
  193. let cFlag = that.currentFlag;
  194. switch (cFlag){
  195. case "rwbm": // 任务编码
  196. this.getRwbmList();
  197. break;
  198. case "bm": // 部门
  199. this.getBmList();
  200. break;
  201. case "zy": // 职员
  202. this.getZyList();
  203. break;
  204. case "bz": //包装
  205. this.getBzList();
  206. break;
  207. case "tp": //托盘
  208. this.getTpList();
  209. break;
  210. case "stock": //单据
  211. this.getStockList();
  212. break;
  213. default:
  214. break;
  215. }
  216. },
  217. // 获取任务编码数据
  218. getRwbmList(){
  219. let that = this;
  220. let params = {
  221. taskType: '1', //(固定,1是入库,0是入库退)
  222. supplierCode: that.formData.supplierCode, //供应商
  223. billTypeCode: that.formData.taskBillTypeCode,
  224. params: {
  225. "keyWord":that.keyWord,
  226. "limit":50
  227. },
  228. }
  229. listRwbm(params).then(res => {
  230. if(res.code === 200){
  231. that.data = res.rows;
  232. this.$refs.popup.open();
  233. }
  234. });
  235. },
  236. // 获取部门数据
  237. getBmList(){
  238. let that = this;
  239. let params = {
  240. status: '0', //(固定)
  241. params: {
  242. "keyWord":that.keyWord,
  243. "limit":50
  244. },
  245. }
  246. listDepartment(params).then(res => {
  247. if(res.code === 200){
  248. that.data = res.rows;
  249. this.$refs.popup.open();
  250. }
  251. });
  252. },
  253. // 职员数据
  254. getZyList(){
  255. let that = this;
  256. if(that.formData.deptCode === ""){
  257. uni.showToast({
  258. title: "请先选择部门",
  259. icon: "none",
  260. })
  261. return;
  262. }
  263. let params = {
  264. status: '0', //(固定)
  265. deptCode: that.formData.deptCode,
  266. params: {
  267. "keyWord":that.keyWord,
  268. "limit":50
  269. },
  270. }
  271. listEmployee(params).then(res => {
  272. if(res.code === 200){
  273. that.data = res.rows;
  274. this.$refs.popup.open();
  275. }
  276. });
  277. },
  278. getBzList(){
  279. let that = this;
  280. let params = {
  281. status: '0',
  282. params: {
  283. "keyWord":that.keyWord,
  284. "limit":50
  285. },
  286. }
  287. listPackage(params).then(res => {
  288. if(res.code === 200){
  289. that.data = res.rows;
  290. this.$refs.popup.open();
  291. }
  292. });
  293. },
  294. getTpList(){
  295. let that = this;
  296. let params = {
  297. status: '0',
  298. params: {
  299. "keyWord":that.keyWord,
  300. "limit":50
  301. },
  302. }
  303. listPallet(params).then(res => {
  304. if(res.code === 200){
  305. that.data = res.rows;
  306. this.$refs.popup.open();
  307. }
  308. });
  309. },
  310. getStockList(){
  311. let that = this;
  312. let params = {
  313. billTypeCode: that.formData.billTypeCode, //业务类型 (为空时不传)
  314. params: {
  315. "keyWord":that.keyWord,
  316. "limit":50
  317. },
  318. }
  319. listStockCheckHead(params).then(res => {
  320. if(res.code === 200){
  321. that.data = res.rows;
  322. this.$refs.popup.open();
  323. }
  324. });
  325. },
  326. },
  327. }
  328. </script>
  329. <style>
  330. @import "@/static/scss/commonpopup.css"
  331. </style>