engin_examine.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  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">{{detailData.examineStatus | statusFilter}}</div>
  20. </el-col>
  21. <el-col :span="8" class="item">
  22. <div class="label">经销商编码</div>
  23. <div class="value">{{detailData.customerId}}</div>
  24. </el-col>
  25. <el-col :span="8" class="item">
  26. <div class="label">项目名称</div>
  27. <div class="value">{{detailData.projectName}}</div>
  28. </el-col>
  29. <el-col :span="8" class="item">
  30. <div class="label">单据类型</div>
  31. <div class="value">{{detailData.orderType}}</div>
  32. </el-col>
  33. <el-col :span="8" class="item">
  34. <div class="label">经销商名称</div>
  35. <div class="value">{{detailData.customerName}}</div>
  36. </el-col>
  37. <el-col :span="8" class="item">
  38. <div class="label">使用单位</div>
  39. <div class="value">{{detailData.useUnit}}</div>
  40. </el-col>
  41. <el-col :span="8" class="item">
  42. <div class="label">安装地址</div>
  43. <div class="value">{{detailData.installAddress}}</div>
  44. </el-col>
  45. <el-col :span="8" class="item">
  46. <div class="label">工程编号</div>
  47. <div class="value">{{detailData.projectNo}}</div>
  48. </el-col>
  49. <el-col :span="8" class="item">
  50. <div class="label">厂工程编码</div>
  51. <div class="value">{{detailData.enginFactoryNo}}</div>
  52. </el-col>
  53. <el-col :span="8" class="item">
  54. <div class="label">工程登录类型</div>
  55. <div class="value">{{detailData.enginSignType}}</div>
  56. </el-col>
  57. <el-col :span="8" class="item">
  58. <div class="label">制单人</div>
  59. <div class="value">{{detailData.createName}}</div>
  60. </el-col>
  61. <el-col :span="8" class="item">
  62. <div class="label">制单日期</div>
  63. <div class="value">{{detailData.createTime}}</div>
  64. </el-col>
  65. <el-col :span="8" class="item">
  66. <div class="label">合同有效期</div>
  67. <div class="value">
  68. <el-date-picker
  69. v-model="detailData.contractExpireDate"
  70. type="date"
  71. prefix-icon="none"
  72. value-format="yyyy-MM-dd"
  73. style="width: 100%;"
  74. placeholder="选择日期">
  75. </el-date-picker>
  76. </div>
  77. </el-col>
  78. <el-col :span="16" class="item">
  79. <div class="label">备注</div>
  80. <div class="value">{{detailData.remark}}</div>
  81. </el-col>
  82. <el-col :span="8" class="item">
  83. <div class="label">业务员</div>
  84. <div class="value">{{detailData.serviceId}}</div>
  85. </el-col>
  86. </el-row>
  87. </div>
  88. <div class="main-title">
  89. <div class="title">货品信息</div>
  90. </div>
  91. <div class="table" style="margin-top: 20px">
  92. <el-table :data="goodsList" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
  93. <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
  94. <el-table-column align="center" label="销售类型" prop="saleTypeId" min-width="160" show-overflow-tooltip>
  95. <template slot-scope="scope">
  96. <el-select v-model="scope.row.saleTypeId" placeholder="选择销售类型" size="small" @change="changeSaleType(scope.$index)">
  97. <el-option
  98. v-for="item in salesTypeList"
  99. :key="item.id"
  100. :label="item.saleName"
  101. :value="item.id">
  102. </el-option>
  103. </el-select>
  104. </template>
  105. </el-table-column>
  106. <el-table-column align="center" label="产品名称" prop="materialNumber" min-width="160" show-overflow-tooltip>
  107. <template slot-scope="scope">
  108. <el-select v-model="scope.row.materialNumber" placeholder="选择产品" size="small" @change="changeGoods(scope.$index)">
  109. <el-option
  110. v-for="item in retailProductList"
  111. :key="item.number"
  112. :label="item.name"
  113. :value="item.number">
  114. </el-option>
  115. </el-select>
  116. </template>
  117. </el-table-column>
  118. <el-table-column align="center" label="产品编码" prop="materialNumber" min-width="120" show-overflow-tooltip></el-table-column>
  119. <el-table-column align="center" label="规格型号" prop="specification" min-width="200" show-overflow-tooltip></el-table-column>
  120. <el-table-column align="center" label="单位" prop="baseUnitId" min-width="100" show-overflow-tooltip></el-table-column>
  121. <el-table-column align="center" label="单价" prop="price" min-width="100" show-overflow-tooltip>
  122. <template slot-scope="scope">
  123. <el-input v-model="scope.row.price" size="small" type="number"></el-input>
  124. </template>
  125. </el-table-column>
  126. <el-table-column align="center" label="数量" prop="qty" min-width="100" show-overflow-tooltip>
  127. <template slot-scope="scope">
  128. <el-input v-model="scope.row.qty" size="small" type="number"></el-input>
  129. </template>
  130. </el-table-column>
  131. <el-table-column align="center" label="订单金额" min-width="100" show-overflow-tooltip>
  132. <template slot-scope="scope">
  133. {{(scope.row.price || 0) * (scope.row.qty || 0)}}
  134. </template>
  135. </el-table-column>
  136. <el-table-column align="center" label="备注" prop="remark" min-width="200" show-overflow-tooltip>
  137. <template slot-scope="scope">
  138. <el-input v-model="scope.row.remark" size="small"></el-input>
  139. </template>
  140. </el-table-column>
  141. <el-table-column align="center" label="税率" prop="taxRate" min-width="100" show-overflow-tooltip></el-table-column>
  142. <el-table-column align="center" label="操作" width="100" fixed="right">
  143. <template slot-scope="scope">
  144. <el-button type="text" @click="deleteItem(scope.$index)">删除</el-button>
  145. </template>
  146. </el-table-column>
  147. </el-table>
  148. <div class="add"><el-button type="text" icon="el-icon-plus" @click="addGoods">添加产品</el-button></div>
  149. </div>
  150. <div class="main-title">
  151. <div class="title">审批信息</div>
  152. </div>
  153. <div class="diy-table-1">
  154. <el-row :gutter="0">
  155. <el-col :span="12" class="item">
  156. <div class="label">审批人</div>
  157. <div class="value">{{userName}}</div>
  158. </el-col>
  159. <el-col :span="12" class="item">
  160. <div class="label">审批结果</div>
  161. <div class="value">
  162. <el-radio-group v-model="examineForm.status">
  163. <el-radio :label="true">通过</el-radio>
  164. <el-radio :label="false">驳回</el-radio>
  165. </el-radio-group>
  166. </div>
  167. </el-col>
  168. <el-col :span="24" class="item">
  169. <div class="label">审批说明</div>
  170. <div class="value"><el-input v-model="examineForm.remark" placeholder="请输入内容"></el-input></div>
  171. </el-col>
  172. </el-row>
  173. </div>
  174. <div class="page-footer">
  175. <div class="footer" :class="classObj">
  176. <el-button type="primary" @click="clickSubmitForm" :loading="formLoading">{{ formLoading ? '提交中 ...' : '提 交' }}</el-button>
  177. <el-popconfirm
  178. title="确定关闭吗?"
  179. @onConfirm="goBack"
  180. style="margin-left: 10px;"
  181. >
  182. <el-button slot="reference">关 闭</el-button>
  183. </el-popconfirm>
  184. </div>
  185. </div>
  186. </div>
  187. </template>
  188. <script>
  189. import { getEnginDetail, getRetailProductList, examineEngin } from "@/api/supply/engin";
  190. import { getTypeList } from "@/api/common";
  191. export default {
  192. name: 'EnginExamine',
  193. componentName: 'EnginExamine',
  194. props: ['listItem'],
  195. filters: {
  196. statusFilter(val) {
  197. const statusList = [
  198. { label: '已保存', value: 'SAVE' },
  199. { label: '待审核', value: 'WAIT' },
  200. { label: '审核通过', value: 'OK' },
  201. { label: '审核驳回', value: 'FAIL' },
  202. { label: '已关闭', value: 'CLOSE' },
  203. ];
  204. let obj = statusList.find(o => o.value == val);
  205. return obj ? obj.label : ''
  206. }
  207. },
  208. data() {
  209. return {
  210. detailData: {},
  211. goodsList: [],
  212. userName: JSON.parse(localStorage.getItem("supply_user")).nickName,
  213. formLoading: false,
  214. examineForm: {
  215. status: true,
  216. remark: '',
  217. },
  218. salesTypeList: [],
  219. retailProductList: [],
  220. }
  221. },
  222. computed: {
  223. sidebar() {
  224. return this.$store.state.app.sidebar
  225. },
  226. classObj() {
  227. return {
  228. hideSidebar: !this.sidebar.opened,
  229. openSidebar: this.sidebar.opened
  230. }
  231. },
  232. },
  233. created() {
  234. this.getDetail();
  235. this.getTypeList();
  236. this.getRetailProductList();
  237. },
  238. methods: {
  239. // 返回列表
  240. goBack() {
  241. this.$emit('backListFormDetail');
  242. },
  243. // 获取详情
  244. getDetail() {
  245. getEnginDetail({id: this.listItem.enginInfoId}).then(res => {
  246. this.detailData = res.data;
  247. this.goodsList = res.data.items;
  248. })
  249. },
  250. // 获取销售类型列表
  251. getTypeList() {
  252. getTypeList({
  253. pageNum: 1,
  254. pageSize: -1,
  255. }).then((res) => {
  256. this.salesTypeList = res.data.records;
  257. });
  258. },
  259. // 获取商品列表
  260. getRetailProductList() {
  261. getRetailProductList({
  262. pageNum: 1,
  263. pageSize: -1,
  264. }).then(res => {
  265. this.retailProductList = res.data.records;
  266. })
  267. },
  268. // 修改销售类型
  269. changeSaleType(index) {
  270. if(this.goodsList[index].saleTypeId) {
  271. let obj = this.salesTypeList.find(o => o.id == this.goodsList[index].saleTypeId);
  272. this.goodsList[index].saleTypeName = obj.saleName;
  273. this.goodsList[index].saleTypeCode = obj.saleCode;
  274. }
  275. },
  276. // 修改产品
  277. changeGoods(index) {
  278. if(this.goodsList[index].materialNumber) {
  279. let obj = this.retailProductList.find(o => o.number == this.goodsList[index].materialNumber);
  280. this.goodsList[index].materialName = obj.name;
  281. this.goodsList[index].materialId = obj.materialId;
  282. this.goodsList[index].specification = obj.specification;
  283. this.goodsList[index].baseUnitId = obj.baseUnit;
  284. this.goodsList[index].price = obj.batchPrice;
  285. this.goodsList[index].taxRate = obj.taxRate;
  286. this.goodsList[index].mainId = obj.mainId;
  287. }
  288. },
  289. // 添加产品
  290. addGoods() {
  291. this.goodsList.push({})
  292. },
  293. // 删除产品
  294. deleteItem(index) {
  295. this.goodsList.splice(index, 1);
  296. },
  297. clickSubmitForm() {
  298. this.formLoading = true;
  299. examineEngin({
  300. enginInfoId: this.listItem.enginInfoId,
  301. examineStatus: this.examineForm.status ? 'OK' : 'FAIL',
  302. examineNote: this.examineForm.remark,
  303. contractExpireDate: this.detailData.contractExpireDate,
  304. items: this.goodsList,
  305. }).then(res => {
  306. this.$successMsg('审批成功');
  307. this.goBack();
  308. this.$parent.getList();
  309. }).finally(res => {
  310. this.formLoading = false;
  311. })
  312. },
  313. }
  314. }
  315. </script>
  316. <style scoped lang="scss">
  317. .detail-container {
  318. width: 100%;
  319. height: 100%;
  320. }
  321. .main-title {
  322. display: flex;
  323. justify-content: space-between;
  324. align-items: center;
  325. margin-top: 20px;
  326. height: 60px;
  327. border-bottom: 1px solid #DCDFE6;
  328. margin-bottom: 20px;
  329. .title {
  330. font-size: 16px;
  331. font-weight: 600;
  332. padding-left: 10px;
  333. }
  334. }
  335. .add {
  336. display: flex;
  337. align-items: center;
  338. justify-content: center;
  339. border: 1px solid #EBEEF5;
  340. border-top: none;
  341. height: 50px;
  342. }
  343. ::v-deep input::-webkit-outer-spin-button,
  344. ::v-deep input::-webkit-inner-spin-button {
  345. -webkit-appearance: none;
  346. }
  347. ::v-deep input[type='number'] {
  348. -moz-appearance: textfield;
  349. }
  350. </style>