commonpopup.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  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, listTaskOut, listRwbm, listSupplier, listDepartment, listEmployee, listCustomer, listExtend } from "@/api/wms/stockOut.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: 'subTaskCode', 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 "stock": // 单据
  169. that.column = [
  170. { name: 'stockCode', label:'单据编号', width:150, align:'center', emptyString:'--'},
  171. { name: 'deptName', label: '部门', width:130, align:'center', emptyString:'--'},
  172. { name: 'warehouseName', label: '仓库', width:150, align:'center', emptyString:'--'},
  173. { name: 'rowCount', label: '行数', width:90, align:'center', emptyString:'--'},
  174. ];
  175. that.getStockList();
  176. break;
  177. default:
  178. break;
  179. }
  180. },
  181. hidePopup() {
  182. this.$refs.popup.close();
  183. },
  184. // 单选当前行
  185. currentChange(row,index){
  186. this.currentSelectData = row;
  187. },
  188. // searchBar
  189. input(value) {// uniSearchBar 的 value 改变时触发事件,返回参数为uniSearchBar的 value e=value
  190. this.keyWord = value;
  191. },
  192. clear(res) {
  193. this.keyWord = "";
  194. },
  195. cancel(res) {
  196. this.keyWord = "";
  197. },
  198. // 查询按钮点击事件
  199. search(){
  200. let that = this;
  201. let cFlag = that.idxFlag;
  202. switch (cFlag){
  203. case "rwbm": // 任务编码
  204. this.getRwbmList();
  205. break;
  206. case "bm": // 部门
  207. that.getBmList();
  208. break;
  209. case "zy": // 职员
  210. this.getZyList();
  211. break;
  212. case "kh": // 职员
  213. this.getKhList();
  214. break;
  215. case "sflb": //收发类别
  216. this.getSflbList();
  217. break;
  218. case "gys": //供应商
  219. this.getGysList();
  220. break;
  221. case "stock": //单据
  222. this.getStockList();
  223. break;
  224. default:
  225. break;
  226. }
  227. },
  228. // 获取任务编码数据
  229. getRwbmList(){
  230. let that = this;
  231. let params = {
  232. //taskType: '1', //(固定,1是入库,0是入库退)
  233. supplierCode: that.formData.supplierCode, //供应商 (为空时不传)
  234. customerCode: that.formData.customerCode, //客户
  235. taskType: -1,
  236. billTypeCode: that.formData.taskBillTypeCode,
  237. params: {
  238. "keyWord":that.keyWord,
  239. "limit":50
  240. },
  241. }
  242. listTaskOut(params).then(res => {
  243. if(res.code === 200){
  244. that.data = res.rows.map(item => {
  245. let a1 = item.wmsTaskOuts;
  246. let a2 = item;
  247. return Object.assign({}, a2, a1);
  248. });
  249. this.$refs.popup.open();
  250. }
  251. });
  252. },
  253. // 获取供应商数据
  254. getGysList(){
  255. let that = this;
  256. let params = {
  257. status: '0', //(固定)
  258. params: {
  259. "keyWord":that.keyWord,
  260. "limit":50
  261. },
  262. }
  263. listSupplier(params).then(res => {
  264. if(res.code === 200){
  265. that.data = res.rows;
  266. this.$refs.popup.open();
  267. }
  268. });
  269. },
  270. // 获取部门数据
  271. getBmList(){
  272. let that = this;
  273. let params = {
  274. status: '0', //(固定)
  275. params: {
  276. "keyWord":that.keyWord,
  277. "limit":50
  278. },
  279. }
  280. listDepartment(params).then(res => {
  281. if(res.code === 200){
  282. that.data = res.rows;
  283. this.$refs.popup.open();
  284. }
  285. });
  286. },
  287. // 职员数据
  288. getZyList(){
  289. let that = this;
  290. if(that.formData.deptCode === ""){
  291. uni.showToast({
  292. title: "请先选择部门",
  293. icon: "none",
  294. })
  295. return;
  296. }
  297. let params = {
  298. status: '0', //(固定)
  299. deptCode: that.formData.deptCode,
  300. params: {
  301. "keyWord":that.keyWord,
  302. "limit":50
  303. },
  304. }
  305. listEmployee(params).then(res => {
  306. if(res.code === 200){
  307. that.data = res.rows;
  308. this.$refs.popup.open();
  309. }
  310. });
  311. },
  312. // 获取客户数据
  313. getKhList(){
  314. let that = this;
  315. let params = {
  316. status: '0', //(固定)
  317. params: {
  318. "keyWord":that.keyWord,
  319. "limit":50
  320. },
  321. }
  322. listCustomer(params).then(res => {
  323. if(res.code === 200){
  324. that.data = res.rows;
  325. this.$refs.popup.open();
  326. }
  327. });
  328. },
  329. // 获取收发类别数据
  330. getSflbList(){
  331. let that = this;
  332. let params = {
  333. extendClassCode: "01.02",
  334. params: {
  335. "keyWord":that.keyWord,
  336. "limit":50
  337. },
  338. }
  339. listExtend(params).then(res => {
  340. if(res.code === 200){
  341. that.data = res.rows;
  342. this.$refs.popup.open();
  343. }
  344. });
  345. },
  346. getStockList(){
  347. let that = this;
  348. let params = {
  349. billTypeCode: that.formData.billTypeCode, //业务类型 (为空时不传)
  350. params: {
  351. "keyWord":that.keyWord,
  352. "limit":50
  353. },
  354. }
  355. ListStockOutHead(params).then(res => {
  356. if(res.code === 200){
  357. that.data = res.rows;
  358. this.$refs.popup.open();
  359. }
  360. });
  361. },
  362. },
  363. }
  364. </script>
  365. <style>
  366. @import "@/static/scss/commonpopup.css"
  367. </style>