manufacturerDetail.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <!-- 供应商采购订单 已出库 -->
  3. <div class="common-box">
  4. <div class="common-card">
  5. <div>
  6. <h3>生产厂商资质</h3>
  7. <div class="right-type">
  8. <el-button
  9. style="margin-bottom: 10px"
  10. type="primary"
  11. @click="handleAdd()"
  12. >添加资质</el-button
  13. >
  14. <el-button
  15. style="margin-bottom: 10px"
  16. type="primary"
  17. @click="goBack()"
  18. >返回</el-button
  19. >
  20. </div>
  21. </div>
  22. <el-table
  23. v-loading="listLoading"
  24. element-loading-text="加载中"
  25. :data="tableData"
  26. fit
  27. stripe
  28. border
  29. :cell-class-name="tableColClassName"
  30. >
  31. <template slot="empty">
  32. <img src="@/assets/nopage.png" alt />
  33. <p>暂无数据</p>
  34. </template>
  35. <el-table-column fixed type="index" label="序号" width="60" />
  36. <el-table-column label="资质证书信息" prop="quaName"> </el-table-column>
  37. <el-table-column label="资质证书编号" prop="quaCode" />
  38. <el-table-column label="发证日期" prop="issuDate" />
  39. <el-table-column label="截止日期" prop="endDate" />
  40. <el-table-column label="资质证件" prop="fileId">
  41. <template slot-scope="scope">
  42. <yl-upload
  43. :fileId="scope.row.fileId"
  44. readonly
  45. v-if="scope.row.fileId"
  46. >
  47. </yl-upload>
  48. </template>
  49. </el-table-column>
  50. <el-table-column label="备注" prop="memo" />
  51. <el-table-column label="操作" width="100" fixed="right">
  52. <template slot-scope="scope">
  53. <el-button type="text" @click="quitData(scope.row)"
  54. >编辑</el-button
  55. >
  56. </template>
  57. </el-table-column>
  58. </el-table>
  59. <el-dialog
  60. class="addclass"
  61. width="30%"
  62. title="资质"
  63. :visible.sync="dialogFormVisible"
  64. >
  65. <el-form label-width="120px" :model="addform" ref="addForm">
  66. <el-form-item
  67. label="资质证书信息"
  68. prop="quaName"
  69. :rules="rules.required"
  70. >
  71. <el-input
  72. v-model="addform.quaName"
  73. placeholder="请输入资质证书信息"
  74. maxlength="50"
  75. ></el-input>
  76. </el-form-item>
  77. <el-form-item label="资质证书编号" prop="quaCode" :rules="rules.required">
  78. <el-input
  79. v-model="addform.quaCode"
  80. placeholder="请输入资质证书编号"
  81. maxlength="50"
  82. ></el-input>
  83. </el-form-item>
  84. <el-form-item label="发证时间" prop="issuDate" :rules="rules.dateRequired">
  85. <el-date-picker
  86. v-model.trim="addform.issuDate"
  87. type="date"
  88. :picker-options="TimeOption1"
  89. placeholder="选择日期"
  90. value-format="yyyy-MM-dd"
  91. ></el-date-picker>
  92. </el-form-item>
  93. <el-form-item label="截止时间" prop="endDate" :rules="rules.dateRequired">
  94. <el-date-picker
  95. v-model.trim="addform.endDate"
  96. type="date"
  97. :picker-options="TimeOption"
  98. placeholder="选择日期"
  99. value-format="yyyy-MM-dd"
  100. ></el-date-picker>
  101. </el-form-item>
  102. </el-form-item>
  103. <el-form-item label="资质证件" prop="fileId" :rules="rules.uploadRequired">
  104. <yl-upload :fileId="addform.fileId" @getUpload="getUpload" urlName="acco">
  105. <template v-slot:dec>只能上传pdf文件</template>
  106. </yl-upload>
  107. <!-- <yl-upload
  108. v-else
  109. :fileId="addform.fileId"
  110. readonly
  111. >
  112. </yl-upload> -->
  113. </el-form-item>
  114. <el-form-item label="备注" prop="memo">
  115. <el-input
  116. v-model="addform.memo"
  117. placeholder="请输入备注"
  118. maxlength="50"
  119. ></el-input>
  120. </el-form-item>
  121. </el-form>
  122. <div slot="footer">
  123. <el-button @click="dialogFormVisible = false">取 消</el-button>
  124. <el-button
  125. type="primary"
  126. v-preventReClick
  127. v-loading="btnLoading"
  128. @click="handledialog()"
  129. >确 定</el-button
  130. >
  131. </div>
  132. </el-dialog>
  133. </div>
  134. </div>
  135. </template>
  136. <script>
  137. import ylUpload from "@/components/yl-upload";
  138. import rules from "@/utils/rules";
  139. import { insertFacQua } from "@/api/consumCataManage-sup/index";
  140. import { selectFacQua } from "@/api/qualityManagement-sup/information-filling";
  141. export default {
  142. components: {
  143. ylUpload,
  144. },
  145. data() {
  146. return {
  147. tableData: [],
  148. rules,
  149. btnLoading: false,
  150. addform: {
  151. splerId: "",
  152. hiCode: "",
  153. quaName: "",
  154. quaCode: "",
  155. issuDate: "",
  156. endDate: "",
  157. fileId: "",
  158. memo: "",
  159. },
  160. TimeOption: {
  161. disabledDate(time) {
  162. return time.getTime() < Date.now();
  163. },
  164. },
  165. TimeOption1: {
  166. disabledDate(time) {
  167. return time.getTime() > Date.now();
  168. },
  169. },
  170. dialogFormVisible: false,
  171. };
  172. },
  173. mounted() {
  174. let { query } = this.$route;
  175. if (query.prodEntp) {
  176. this.updateData();
  177. }
  178. },
  179. methods: {
  180. //返回主页面
  181. goBack(){
  182. this.$router.push({
  183. name: "ManufacturerFilling",
  184. });
  185. },
  186. //编辑资质
  187. quitData(row) {
  188. let newRow = { ...row };
  189. this.addform = newRow;
  190. this.dialogFormVisible = true;
  191. },
  192. handleAdd() {
  193. this.dialogFormVisible = true;
  194. setTimeout(() => {
  195. this.$refs.addForm.clearValidate();
  196. this.addform = {
  197. splerId: "",
  198. hiCode: "",
  199. quaName: "",
  200. quaCode: "",
  201. issuDate: "",
  202. endDate: "",
  203. fileId: "",
  204. memo: "",
  205. };
  206. }, 0);
  207. },
  208. getUpload(id) {
  209. this.addform.fileId = id;
  210. if (id) {
  211. this.$refs.addForm.clearValidate("fileId");
  212. } else {
  213. this.$refs.addForm.validateField("fileId");
  214. }
  215. },
  216. // 确认
  217. handledialog() {
  218. this.$refs["addForm"].validate((valid) => {
  219. if (valid) {
  220. this.$confirm("确认提交", "提示", {
  221. confirmButtonText: "确定",
  222. cancelButtonText: "取消",
  223. type: "warning",
  224. })
  225. .then(() => {
  226. this.btnLoading = true;
  227. insertFacQua({
  228. ...this.addform,
  229. splerId: this.$store.state.user.orgId,
  230. prodEntp: this.$route.query.prodEntp,
  231. })
  232. .then((response) => {
  233. this.$message({
  234. message: "提交成功",
  235. type: "success",
  236. });
  237. this.dialogFormVisible = false;
  238. this.btnLoading = false;
  239. this.$refs.addForm.resetFields();
  240. this.updateData();
  241. })
  242. .catch(() => {
  243. this.loading1 = false;
  244. this.$message({
  245. message: "提交失败",
  246. type: "error",
  247. });
  248. });
  249. })
  250. .catch(() => {});
  251. }
  252. });
  253. },
  254. //更新资质数据
  255. updateData() {
  256. let proEpt = this.$route.query.prodEntp;
  257. selectFacQua({ prodEntp: proEpt }).then((res) => {
  258. if (res.success == true) {
  259. if (
  260. res.data.records[0].facQuaList &&
  261. res.data.records[0].facQuaList.length > 0
  262. ) {
  263. }
  264. this.tableData = res.data.records[0].facQuaList;
  265. }
  266. });
  267. },
  268. },
  269. };
  270. </script>
  271. <style lang="scss" scoped></style>