engin_examine.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  1. <template>
  2. <div class="detail-container">
  3. <el-page-header @back="goBack" content="审批"></el-page-header>
  4. <div class="main-title">
  5. <div class="title">工程信息单</div>
  6. </div>
  7. <div class="diy-table-1">
  8. <el-row>
  9. <el-col :span="8" class="item">
  10. <div class="label">工程信息单号</div>
  11. <div class="value">{{detailData.enginInfoNo}}</div>
  12. </el-col>
  13. <el-col :span="8" class="item">
  14. <div class="label">订单日期</div>
  15. <div class="value">{{detailData.orderDate}}</div>
  16. </el-col>
  17. <el-col :span="8" class="item">
  18. <div class="label">业务员</div>
  19. <div class="value">
  20. <el-select v-model="detailData.serviceId" placeholder="选择业务员" size="small" filterable clearable style="width: 100%">
  21. <el-option
  22. v-for="item in salesmanList"
  23. :key="item.adminUserId"
  24. :label="item.nickName"
  25. :value="item.adminUserId">
  26. </el-option>
  27. </el-select>
  28. </div>
  29. </el-col>
  30. <el-col :span="8" class="item">
  31. <div class="label">经销商编码</div>
  32. <div class="value">{{detailData.customerNumber}}</div>
  33. </el-col>
  34. <el-col :span="8" class="item">
  35. <div class="label">项目名称</div>
  36. <div class="value">
  37. <el-input v-model="detailData.projectName" placeholder="请输入项目名称"></el-input>
  38. </div>
  39. </el-col>
  40. <el-col :span="8" class="item">
  41. <div class="label">机型类别</div>
  42. <div class="value">
  43. <el-select v-model="detailData.machineType" placeholder="选择机型类别" size="small" clearable style="width: 100%">
  44. <el-option
  45. v-for="item in machineTypeList"
  46. :key="item.dictCode" :label="item.dictValue" :value="item.dictCode">
  47. </el-option>
  48. </el-select>
  49. </div>
  50. </el-col>
  51. <el-col :span="8" class="item">
  52. <div class="label">经销商名称</div>
  53. <div class="value">{{detailData.customerName}}</div>
  54. </el-col>
  55. <el-col :span="8" class="item">
  56. <div class="label">使用单位</div>
  57. <div class="value">
  58. <el-input v-model="detailData.useUnit" placeholder="请输入使用单位"></el-input>
  59. </div>
  60. </el-col>
  61. <el-col :span="8" class="item">
  62. <div class="label">行业类别</div>
  63. <div class="value">
  64. <el-select v-model="detailData.tradeCategory" placeholder="选择行业类别" size="small" clearable style="width: 100%">
  65. <el-option
  66. v-for="item in tradeCategoryList"
  67. :key="item.value" :label="item.label" :value="item.value">
  68. </el-option>
  69. </el-select>
  70. </div>
  71. </el-col>
  72. <el-col :span="8" class="item">
  73. <div class="label">工程编号</div>
  74. <div class="value">
  75. <el-input v-model="detailData.projectNo" placeholder="请输入工程编号"></el-input>
  76. </div>
  77. </el-col>
  78. <el-col :span="8" class="item">
  79. <div class="label">厂工程编码</div>
  80. <div class="value">
  81. <el-input v-model="detailData.enginFactoryNo" placeholder="请输入厂工程编码"></el-input>
  82. </div>
  83. </el-col>
  84. <el-col :span="8" class="item">
  85. <div class="label">工程登录类型</div>
  86. <div class="value">
  87. <el-select v-model="detailData.enginSignType" placeholder="选择工程登录类型" size="small" clearable style="width: 100%">
  88. <el-option
  89. v-for="item in loginTypeList"
  90. :key="item.dictCode" :label="item.dictValue" :value="item.dictCode">
  91. </el-option>
  92. </el-select>
  93. </div>
  94. </el-col>
  95. <el-col :span="8" class="item">
  96. <div class="label">联系人</div>
  97. <div class="value">
  98. <el-input v-model="detailData.linkman" placeholder="请输入联系人"></el-input>
  99. </div>
  100. </el-col>
  101. <el-col :span="8" class="item">
  102. <div class="label">联系电话</div>
  103. <div class="value">
  104. <el-input v-model="detailData.phone" placeholder="请输入联系电话"></el-input>
  105. </div>
  106. </el-col>
  107. <el-col :span="8" class="item">
  108. <div class="label">固定电话</div>
  109. <div class="value">
  110. <el-input v-model="detailData.tel" placeholder="请输入固定电话"></el-input>
  111. </div>
  112. </el-col>
  113. <el-col :span="24" class="item">
  114. <div class="label">安装地址</div>
  115. <div class="value">
  116. <el-input v-model="detailData.installAddress" placeholder="请输入安装地址"></el-input>
  117. </div>
  118. </el-col>
  119. <el-col :span="24" class="item" v-if="!isCustomer">
  120. <div class="label">格力内部备注</div>
  121. <div class="value">
  122. <el-input v-model="detailData.geLiInerNote" placeholder="请输入格力内部备注"></el-input>
  123. </div>
  124. </el-col>
  125. <el-col :span="24" class="item">
  126. <div class="label">格力回复</div>
  127. <div class="value">
  128. <el-input v-model="detailData.geLiNote" placeholder="请输入格力回复"></el-input>
  129. </div>
  130. </el-col>
  131. <el-col :span="24" class="item">
  132. <div class="label">备注</div>
  133. <div class="value">
  134. <el-input v-model="detailData.remark" placeholder="请输入备注"></el-input>
  135. </div>
  136. </el-col>
  137. <el-col :span="8" class="item">
  138. <div class="label">制单人</div>
  139. <div class="value">{{detailData.createBy}}</div>
  140. </el-col>
  141. <el-col :span="8" class="item">
  142. <div class="label">制单日期</div>
  143. <div class="value">{{detailData.createTime}}</div>
  144. </el-col>
  145. <el-col :span="8" class="item">
  146. <div class="label">合同有效期</div>
  147. <div class="value">
  148. <el-date-picker
  149. v-model="detailData.contractExpireDate"
  150. type="date"
  151. prefix-icon="none"
  152. value-format="yyyy-MM-dd"
  153. style="width: 100%;"
  154. placeholder="选择日期">
  155. </el-date-picker>
  156. </div>
  157. </el-col>
  158. </el-row>
  159. </div>
  160. <div class="main-title">
  161. <div class="title">货品信息</div>
  162. <div>
  163. <el-button type="primary" size="small" icon="el-icon-plus" @click="openDialog">添加货品</el-button>
  164. </div>
  165. </div>
  166. <div class="table" style="margin-top: 20px">
  167. <el-table :data="goodsList" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400"
  168. show-summary
  169. :summary-method="$getSummaries">
  170. <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
  171. <el-table-column align="left" label="销售类型" prop="saleTypeName" min-width="120" show-overflow-tooltip></el-table-column>
  172. <el-table-column align="left" label="物料编码" prop="materialNumber" min-width="120" show-overflow-tooltip></el-table-column>
  173. <el-table-column align="left" label="产品编码" prop="materialOldNumber" min-width="120" show-overflow-tooltip></el-table-column>
  174. <el-table-column align="left" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
  175. <el-table-column align="left" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip>
  176. <template slot-scope="scope">
  177. <el-input v-model="scope.row.specification" size="small"></el-input>
  178. </template>
  179. </el-table-column>
  180. <el-table-column align="left" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
  181. <el-table-column align="right" label="单价" prop="price" min-width="100" show-overflow-tooltip>
  182. <template slot-scope="scope">
  183. <el-input v-model="scope.row.price" size="small" type="number"></el-input>
  184. </template>
  185. </el-table-column>
  186. <el-table-column align="right" label="数量" prop="qty" min-width="100" show-overflow-tooltip>
  187. <template slot-scope="scope">
  188. <el-input v-model="scope.row.qty" size="small" type="number"></el-input>
  189. </template>
  190. </el-table-column>
  191. <el-table-column align="right" label="订单金额" min-width="100" prop="compute_amount" show-overflow-tooltip>
  192. <template slot-scope="scope">
  193. {{scope.row.compute_amount | numToFixed}}
  194. </template>
  195. </el-table-column>
  196. <el-table-column align="left" label="备注" prop="remark" min-width="200" show-overflow-tooltip>
  197. <template slot-scope="scope">
  198. <el-input v-model="scope.row.remark" size="small"></el-input>
  199. </template>
  200. </el-table-column>
  201. <el-table-column align="left" label="税率" prop="taxRate" min-width="100" show-overflow-tooltip></el-table-column>
  202. <el-table-column align="center" label="操作" width="100" fixed="right">
  203. <template slot-scope="scope">
  204. <el-button type="text" @click="deleteItem(scope.$index)">删除</el-button>
  205. </template>
  206. </el-table-column>
  207. </el-table>
  208. </div>
  209. <div class="main-title">
  210. <div class="title">审批信息</div>
  211. </div>
  212. <div class="diy-table-1">
  213. <el-row :gutter="0">
  214. <el-col :span="12" class="item">
  215. <div class="label">审批人</div>
  216. <div class="value">{{userName}}</div>
  217. </el-col>
  218. <el-col :span="12" class="item">
  219. <div class="label">审批结果</div>
  220. <div class="value">
  221. <el-radio-group v-model="examineForm.examineResult">
  222. <el-radio :label="true">通过</el-radio>
  223. <el-radio :label="false">驳回</el-radio>
  224. </el-radio-group>
  225. </div>
  226. </el-col>
  227. <el-col :span="24" class="item">
  228. <div class="label">审批说明</div>
  229. <div class="value"><el-input v-model="examineForm.remark" placeholder="请输入内容"></el-input></div>
  230. </el-col>
  231. </el-row>
  232. </div>
  233. <div class="page-footer">
  234. <div class="footer">
  235. <el-button type="primary" @click="clickSubmitForm" :loading="formLoading">{{ formLoading ? '提交中 ...' : '提 交' }}</el-button>
  236. <el-popconfirm
  237. title="确定关闭吗?"
  238. @onConfirm="goBack"
  239. style="margin-left: 10px;"
  240. >
  241. <el-button slot="reference">关 闭</el-button>
  242. </el-popconfirm>
  243. </div>
  244. </div>
  245. <el-dialog title="添加产品" :visible.sync="isShowGoodsDialog" width="80%">
  246. <el-form ref="goodsScreenForm" :model="goodsScreenForm" size="small" label-position="left">
  247. <el-row :gutter="20">
  248. <el-col :xs="12" :sm="6" :lg="6">
  249. <el-form-item prop="salesType">
  250. <el-select v-model="goodsScreenForm.salesType" placeholder="选择销售类型" style="width: 100%" clearable>
  251. <el-option v-for="item in salesTypeList" :key="item.id" :label="item.saleName" :value="item.id"></el-option>
  252. </el-select>
  253. </el-form-item>
  254. </el-col>
  255. <el-col :xs="12" :sm="6" :lg="6">
  256. <el-form-item prop="proNum">
  257. <el-input v-model="goodsScreenForm.proNum" placeholder="请输入产品编码"></el-input>
  258. </el-form-item>
  259. </el-col>
  260. <el-col :xs="12" :sm="6" :lg="6">
  261. <el-form-item prop="proName">
  262. <el-input v-model="goodsScreenForm.proName" placeholder="请输入产品名称"></el-input>
  263. </el-form-item>
  264. </el-col>
  265. <el-col :xs="12" :sm="6" :lg="6">
  266. <el-form-item prop="proModel">
  267. <el-input v-model="goodsScreenForm.proModel" placeholder="请输入产品型号"></el-input>
  268. </el-form-item>
  269. </el-col>
  270. <el-col :xs="12" :sm="6" :lg="6">
  271. <el-form-item prop="price1" style="display: flex">
  272. <el-input v-model="goodsScreenForm.price1" placeholder="请输入价格" style="width: 46%"></el-input>
  273. <span> - </span>
  274. <el-input v-model="goodsScreenForm.price2" placeholder="请输入价格" style="width: 46%"></el-input>
  275. </el-form-item>
  276. </el-col>
  277. <el-col :xs="12" :sm="18" :lg="18" class="tr">
  278. <el-form-item label="">
  279. <el-button size="small" @click="resetGoodsScreenForm">清空</el-button>
  280. <el-button size="small" type="primary" @click="submitGoodsScreenForm">搜索</el-button>
  281. </el-form-item>
  282. </el-col>
  283. </el-row>
  284. </el-form>
  285. <div class="tables">
  286. <div class="table">
  287. <el-table :data="leftGoodsList" element-loading-text="Loading" border fit highlight-current-row stripe height="400" @selection-change="leftSelectionChange">
  288. <el-table-column align="center" type="selection" width="55" :selectable='checkboxSelect'></el-table-column>
  289. <el-table-column align="center" label="产品编码" prop="number" min-width="100" show-overflow-tooltip></el-table-column>
  290. <el-table-column align="center" label="产品名称" prop="name" min-width="160" show-overflow-tooltip></el-table-column>
  291. <el-table-column align="center" label="产品型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
  292. <el-table-column align="center" label="产品价格" prop="batchPrice" min-width="80" show-overflow-tooltip></el-table-column>
  293. </el-table>
  294. <div class="pagination clearfix" style="margin-top: 10px">
  295. <div class="fr">
  296. <el-pagination
  297. @current-change="handleTableCurrentChange"
  298. :current-page="currentPage"
  299. :page-size="10"
  300. background
  301. layout="prev, pager, next"
  302. :total="listTotal">
  303. </el-pagination>
  304. </div>
  305. </div>
  306. </div>
  307. <div class="buttons">
  308. <el-button size="small" type="primary" @click="addAllGoods">全部添加</el-button>
  309. <el-button size="small" type="primary" @click="addGoods">添&emsp;加</el-button>
  310. <el-button size="small" type="danger" @click="deleteGoods">删&emsp;除</el-button>
  311. <el-button size="small" type="danger" @click="deleteAllGoods">全部删除</el-button>
  312. </div>
  313. <div class="table">
  314. <el-table :data="rightGoodsList" element-loading-text="Loading" border fit highlight-current-row stripe height="400" @selection-change="rightSelectionChange">
  315. <el-table-column align="center" type="selection" width="55"></el-table-column>
  316. <el-table-column align="center" label="产品编码" prop="number" min-width="100" show-overflow-tooltip></el-table-column>
  317. <el-table-column align="center" label="产品名称" prop="name" min-width="160" show-overflow-tooltip></el-table-column>
  318. <el-table-column align="center" label="产品型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
  319. <el-table-column align="center" label="产品价格" prop="batchPrice" min-width="80" show-overflow-tooltip></el-table-column>
  320. </el-table>
  321. </div>
  322. </div>
  323. <span slot="footer" class="dialog-footer">
  324. <el-button @click="closeDialog">取 消</el-button>
  325. <el-button type="primary" @click="submitAddGoods">确 定</el-button>
  326. </span>
  327. </el-dialog>
  328. </div>
  329. </template>
  330. <script>
  331. import { getEnginDetail, getRetailProductList, examineEngin } from "@/api/supply/engin";
  332. import { getTypeList, getSalesmanList, getDictList } from "@/api/common";
  333. import { mapGetters } from "vuex";
  334. export default {
  335. name: 'EnginExamine',
  336. componentName: 'EnginExamine',
  337. props: ['listItem'],
  338. filters: {
  339. statusFilter(val) {
  340. const statusList = [
  341. { label: '已保存', value: 'SAVE' },
  342. { label: '待审核', value: 'WAIT' },
  343. { label: '审核通过', value: 'OK' },
  344. // { label: '审核驳回', value: 'FAIL' },,
  345. { label: '已关闭', value: 'CLOSE' },
  346. ];
  347. let obj = statusList.find(o => o.value == val);
  348. return obj ? obj.label : ''
  349. }
  350. },
  351. data() {
  352. return {
  353. detailData: {},
  354. goodsList: [],
  355. userName: JSON.parse(localStorage.getItem("supply_user")).nickName,
  356. formLoading: false,
  357. examineForm: {
  358. examineResult: true,
  359. remark: '',
  360. },
  361. salesTypeList: [],
  362. salesmanList: [],
  363. machineTypeList: [],
  364. loginTypeList: [],
  365. powerList: [],
  366. tradeCategoryList: [
  367. {value: '房地产', label: '房地产'},
  368. {value: '公共建筑', label: '公共建筑'},
  369. {value: '工业制造', label: '工业制造'},
  370. {value: '商业项目', label: '商业项目'},
  371. {value: '采暖及清洁能源', label: '采暖及清洁能源'},
  372. {value: '轨道交通', label: '轨道交通'},
  373. {value: '数据通讯', label: '数据通讯'},
  374. {value: '冷冻冷藏', label: '冷冻冷藏'},
  375. {value: '高端制造', label: '高端制造'},
  376. {value: '医院医疗', label: '医院医疗'},
  377. {value: '其他', label: '其他'},
  378. ],
  379. isShowGoodsDialog: false,
  380. goodsScreenForm: {
  381. proNum: '',
  382. proName: '',
  383. proModel: '',
  384. price1: '',
  385. price2: '',
  386. salesType: '',
  387. },
  388. currentPage: 1,
  389. listTotal: 0,
  390. leftGoodsList: [],
  391. rightGoodsList: [],
  392. leftSelection: [],
  393. rightSelection: [],
  394. salesTypeList:[]
  395. }
  396. },
  397. computed:{
  398. ...mapGetters(['isCustomer']),
  399. },
  400. watch: {
  401. goodsList: {
  402. handler(newValue, oldValue) {
  403. if(newValue && newValue.length) {
  404. newValue.forEach((item, index) => {
  405. this.goodsList[index].compute_amount = item.price * item.qty;
  406. })
  407. }
  408. },
  409. immediate: true,
  410. deep: true
  411. }
  412. },
  413. created() {
  414. this.getDetail();
  415. this.getTypeList();
  416. this.getSalesmanList();
  417. this.getDictList();
  418. },
  419. methods: {
  420. // 返回列表
  421. goBack() {
  422. this.$emit('backListFormDetail');
  423. },
  424. // 获取详情
  425. getDetail() {
  426. getEnginDetail({id: this.listItem.enginInfoId}).then(res => {
  427. this.detailData = res.data;
  428. res.data.items.forEach(item => {
  429. item.sums1 = ['qty', 'hasOrderQty', 'hasDeliverQty'];
  430. item.sums2 = ['compute_amount', 'price'];
  431. })
  432. this.goodsList = res.data.items;
  433. })
  434. },
  435. // 获取销售类型列表
  436. getTypeList() {
  437. getTypeList({
  438. pageNum: 1,
  439. pageSize: -1,
  440. }).then((res) => {
  441. this.salesTypeList = res.data.records;
  442. });
  443. },
  444. getSalesmanList() {
  445. getSalesmanList({
  446. pageNum: 1,
  447. pageSize: -1,
  448. isCustomer: 0,
  449. status: true,
  450. }).then(res => {
  451. this.salesmanList = res.data.records;
  452. })
  453. },
  454. // 获取产品大类列表
  455. getDictList() {
  456. getDictList({sysDictEnum: 'MACHINE_TYPE'}).then(res => {
  457. this.machineTypeList = res.data;
  458. })
  459. getDictList({sysDictEnum: 'POWER_CATEGORY'}).then(res => {
  460. this.powerList = res.data;
  461. })
  462. getDictList({sysDictEnum: 'SIGN_TYPE'}).then(res => {
  463. this.loginTypeList = res.data;
  464. })
  465. },
  466. // 获取商品列表
  467. getGoodsList() {
  468. getRetailProductList({
  469. pageNum: this.currentPage,
  470. pageSize: 10,
  471. saleId: this.goodsScreenForm.salesType,
  472. materialCode: this.goodsScreenForm.proNum,
  473. materialName: this.goodsScreenForm.proName,
  474. specification: this.goodsScreenForm.proModel,
  475. price1: this.goodsScreenForm.price1,
  476. price2: this.goodsScreenForm.price2,
  477. }).then(res => {
  478. let oldGoodsList = this.goodsList;
  479. let newGoodsList = res.data.records;
  480. for(let i = 0; i < oldGoodsList.length; i++) {
  481. let oldItem = oldGoodsList[i]
  482. for(let j = 0; j < newGoodsList.length; j++) {
  483. let newItem = newGoodsList[j]
  484. if(newItem.id === oldItem.id){
  485. newGoodsList[j].selected = true;
  486. break;
  487. }
  488. }
  489. }
  490. res.data.records.forEach(item => {
  491. item.materialName = item.name;
  492. item.materialCode = item.number;
  493. item.saleTypeName = item.saleName;
  494. item.unit = item.baseUnit;
  495. item.price = item.batchPrice;
  496. item.tax = item.taxRate;
  497. item.isDirectTransfer = false;
  498. item.directTransferQty = '';
  499. item.status1 = '';
  500. item.status2 = '';
  501. item.rebateAmount = '';
  502. item.rebateRate = '';
  503. item.productPriceId = item.id;
  504. // item.customerWalletId = (item.wallets && item.wallets.length) ? item.wallets[0].customerWalletId : '';
  505. });
  506. this.leftGoodsList = res.data.records;
  507. this.listTotal = res.data.total;
  508. })
  509. },
  510. // 查询重复值并禁选
  511. checkboxSelect(row, rowIndex) {
  512. if (row.selected) {
  513. return false // 禁用
  514. }else{
  515. return true // 不禁用
  516. }
  517. },
  518. // 点击 选择商品
  519. openDialog() {
  520. this.isShowGoodsDialog = true;
  521. this.getGoodsList();
  522. },
  523. // 提交筛选表单
  524. submitGoodsScreenForm() {
  525. this.currentPage = 1;
  526. this.getGoodsList();
  527. },
  528. // 重置筛选表单
  529. resetGoodsScreenForm() {
  530. this.$refs.goodsScreenForm.resetFields();
  531. this.currentPage = 1;
  532. this.getGoodsList();
  533. },
  534. // 更改列表当前页
  535. handleTableCurrentChange(val) {
  536. this.currentPage = val;
  537. this.getGoodsList();
  538. },
  539. // 关闭 弹窗
  540. closeDialog() {
  541. this.isShowGoodsDialog = false;
  542. },
  543. // 左侧列表选择
  544. leftSelectionChange(val) {
  545. this.leftSelection = val;
  546. },
  547. // 右侧列表选择
  548. rightSelectionChange(val) {
  549. this.rightSelection = val;
  550. },
  551. // 数组去重
  552. delRepeat(arr1, arr2) {
  553. let allArr = arr1.concat(arr2); // 两个数组对象合并
  554. let newArr = []; // 存放去重后数据的新数组
  555. for(let i=0; i<allArr.length; i++){ // 循环allArr数组对象的内容
  556. let flag = true; // 建立标记,判断数据是否重复,true为不重复
  557. for(let j=0; j<newArr.length; j++){ // 循环新数组的内容
  558. if(allArr[i].id == newArr[j].id){ // 让allArr数组对象的内容与新数组的内容作比较,相同的话,改变标记为false
  559. flag = false;
  560. }
  561. }
  562. if(flag){ // 判断是否重复
  563. newArr.push(allArr[i]); // 不重复的放入新数组。 新数组的内容会继续进行上边的循环。
  564. }
  565. }
  566. return newArr;
  567. },
  568. // 全部添加
  569. addAllGoods() {
  570. this.rightGoodsList = this.delRepeat(this.leftGoodsList, this.rightGoodsList);
  571. },
  572. // 添加
  573. addGoods() {
  574. this.rightGoodsList = this.delRepeat(this.leftSelection, this.rightGoodsList);
  575. },
  576. // 删除
  577. deleteGoods() {
  578. let rightGoodsList = this.rightGoodsList;
  579. let rightSelection = this.rightSelection;
  580. for(let i = 0; i < rightGoodsList.length; i++) {
  581. for(let j = 0; j < rightSelection.length; j++) {
  582. if(rightSelection[j].materialId == rightGoodsList[i].materialId){
  583. this.rightGoodsList.splice(i, 1);
  584. }
  585. }
  586. }
  587. },
  588. // 全部删除
  589. deleteAllGoods() {
  590. this.rightGoodsList = [];
  591. },
  592. // 确定 添加产品
  593. submitAddGoods() {
  594. // this.goodsList = this.delRepeat(this.rightGoodsList, this.goodsList);
  595. this.goodsList = this.goodsList.concat(this.rightGoodsList);
  596. this.isShowGoodsDialog = false;
  597. this.leftGoodsList = [];
  598. this.rightGoodsList = [];
  599. },
  600. // 删除产品
  601. deleteItem(index) {
  602. this.goodsList.splice(index, 1);
  603. },
  604. clickSubmitForm() {
  605. if(!this.detailData.serviceId) {
  606. return this.$errorMsg('请选择业务员');
  607. }
  608. this.$confirm('此操作将审批订单, 是否继续?', '提示', {
  609. confirmButtonText: '确定',
  610. cancelButtonText: '取消',
  611. type: 'warning'
  612. }).then(() => {
  613. let saleManItem = this.salesmanList.find(o => o.adminUserId == this.detailData.serviceId);
  614. let params = JSON.parse(JSON.stringify(this.detailData));
  615. params.enginInfoId = this.listItem.enginInfoId;
  616. params.mainId = this.listItem.mainId;
  617. params.examineResult = this.examineForm.examineResult;
  618. params.examineNote = this.examineForm.remark;
  619. params.serviceName = saleManItem.nickName;
  620. params.items = this.goodsList;
  621. this.formLoading = true;
  622. examineEngin(params).then(res => {
  623. this.$successMsg('审批成功');
  624. this.goBack();
  625. this.$parent.getList();
  626. }).finally(res => {
  627. this.formLoading = false;
  628. })
  629. }).catch(() => {});
  630. },
  631. }
  632. }
  633. </script>
  634. <style scoped lang="scss">
  635. .detail-container {
  636. width: 100%;
  637. height: 100%;
  638. }
  639. .main-title {
  640. display: flex;
  641. justify-content: space-between;
  642. align-items: center;
  643. margin-top: 20px;
  644. height: 60px;
  645. border-bottom: 1px solid #DCDFE6;
  646. margin-bottom: 20px;
  647. .title {
  648. font-size: 16px;
  649. font-weight: 600;
  650. padding-left: 10px;
  651. }
  652. }
  653. .tables {
  654. display: flex;
  655. margin-top: 10px;
  656. .table {
  657. width: 45%;
  658. }
  659. .buttons {
  660. display: flex;
  661. flex-direction: column;
  662. justify-content: center;
  663. align-items: center;
  664. padding: 0 10px;
  665. button {
  666. margin: 0;
  667. margin-top: 10px;
  668. }
  669. }
  670. }
  671. ::v-deep input::-webkit-outer-spin-button,
  672. ::v-deep input::-webkit-inner-spin-button {
  673. -webkit-appearance: none;
  674. }
  675. ::v-deep input[type='number'] {
  676. -moz-appearance: textfield;
  677. }
  678. </style>