You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

233 lines
8.6 KiB

3 weeks ago
  1. 
  2. @{
  3. ViewBag.Title = "";
  4. Layout = "~/Views/Shared/_Form.cshtml";
  5. }
  6. <script src="~/Content/js/datepicker/WdatePicker.js"></script>
  7. <!--引入 element-ui 的样式,-->
  8. <link rel="stylesheet" href="~/Content/element-ui/lib/theme-chalk/index.css">
  9. <script src="~/Content/vue/dist/vue.js"></script>
  10. <script src="~/Content/element-ui/lib/index.js"></script>
  11. <script src="~/Content/axios.min.js"></script>
  12. <style>
  13. </style>
  14. <form id="form1">
  15. <div id="app">
  16. <template>
  17. <el-form ref="form" :model="form" label-width="80px">
  18. <el-divider></el-divider>
  19. <el-row :gutter="24">
  20. <el-col :span="24">
  21. </el-col>
  22. </el-row>
  23. <el-row :gutter="24">
  24. <el-col :span="2">
  25. &nbsp;&nbsp;
  26. </el-col>
  27. <el-col :span="20">
  28. <el-table ref="dataSource4File" highlight-current-row
  29. :data="dataSource4File"
  30. style="width: 100%"
  31. stripe border
  32. size="mini"
  33. height="200"
  34. v-on:selection-change="handleSelectionChange4File">
  35. <el-table-column type="index" width="50"></el-table-column>
  36. <el-table-column type="selection" width="55"> </el-table-column>
  37. <el-table-column prop="Code" label="送货单单号" width="200">
  38. </el-table-column>
  39. @*<el-table-column prop="InvCode" label="料品编码" width="100">
  40. </el-table-column>
  41. <el-table-column prop="BatchCode" label="批次" width="100">
  42. </el-table-column>
  43. <el-table-column prop="VenCode" label="供应商" width="100">
  44. </el-table-column>*@
  45. <el-table-column prop="FileName" label="文件名称" width="600">
  46. </el-table-column>
  47. <el-table-column label="操作">
  48. <template slot-scope="scope">
  49. @*<a id="NF-Delete" authorize="yes" class="btn btn-primary" v-on:click="handleDelete(scope.$index, scope.row)"><i class="fa fa-trash-o"></i>删除</a>*@
  50. @*<a id="NF-Add" authorize="no" style="margin-left:3px;" class="btn btn-primary" v-on:click="handleView(scope.$index, scope.row)"><i class="fa fa-pencil-square-o"></i>预览</a>*@
  51. <a style="margin-left:3px;" class="btn btn-success" v-on:click="handleDownload(scope.$index, scope.row)"> <i class="fa fa-download"></i>下载 </a>
  52. </template>
  53. </el-table-column>
  54. </el-table>
  55. </el-col>
  56. <el-col :span="2">
  57. &nbsp;&nbsp;
  58. </el-col>
  59. </el-row>
  60. </el-form>
  61. </template>
  62. </div>
  63. </form>
  64. <script>
  65. var SRMFileUrl ='@System.Web.Configuration.WebConfigurationManager.ConnectionStrings["SRMURL"].ConnectionString';
  66. </script>
  67. <script type="text/javascript">
  68. //const { Console } = require("node:console");
  69. var vm = new Vue({
  70. el: '#app',
  71. data: {
  72. ASNCode: '',
  73. InvCode: '',
  74. InvCode: '',
  75. BatchCode:'',
  76. userCode: "",
  77. ssList: [],
  78. form: {},
  79. detail: {
  80. key:0,
  81. SetValueMin: 0,
  82. SetValueMax: 0,
  83. SampleQuantity: 0,
  84. EATTRIBUTE1: 0,
  85. EATTRIBUTE2: 0,
  86. EATTRIBUTE3: 0,
  87. },
  88. currentRow4Right: null,//规则单选
  89. rules: {
  90. RulesCode: [{ required: true, message: '请输入', trigger: 'blur' },],
  91. RulesName: [{ required: true, message: '请输入', trigger: 'blur' },],
  92. },
  93. dataSource4File: [],
  94. multipleSelection:[],
  95. },
  96. //挂在DOM 触发
  97. mounted() {
  98. let reactiveObject = {
  99. RulesCode: '',
  100. RulesName: '',
  101. RulesDesc: '',
  102. Type: '',
  103. Enable: true,
  104. DetailList: [],
  105. };
  106. this.form = reactiveObject;
  107. // this.loadGrid();
  108. // this.show();
  109. debugger;
  110. this.ASNCode = '@ViewData["ASNCode"]';
  111. this.InvCode = '@ViewData["InvCode"]';
  112. this.BatchCode='@ViewData["BatchCode"]';
  113. this.initControl();
  114. // console.log(this.id);
  115. },
  116. beforeDestroy() {
  117. // this.autoScrol1(true);
  118. },
  119. methods: {
  120. //删除行
  121. handleDelete(index, row) {
  122. //debugger;
  123. // console.log(index, row);
  124. this.dataSource4File = this.dataSource4File.filter(x => x.FileID != row.FileID);
  125. let ids = [];
  126. ids.push(row.FileID);
  127. axios
  128. .post('/BBWMS/IQCQuality/DeleteItem2AqlFile', { keyValue: JSON.stringify(ids) })
  129. .then(function (res) {
  130. if (res.data.state == "success") {
  131. $.modalMsg("操作成功", "success");
  132. // that.query();
  133. }
  134. else
  135. $.modalMsg(res.data.message, "warning");
  136. })
  137. .catch(function (error) { // 请求失败处理
  138. alert(error);
  139. });
  140. },
  141. handleView(index, row) {
  142. // debugger;
  143. axios
  144. .get('/BBWMS/IQCQuality/GetVendorFilePath?fileName=' + row.FileName)
  145. .then(function (res) {
  146. if (res.data) {
  147. //console.log(res.data.message);
  148. window.open(res.data.message);
  149. }
  150. })
  151. .catch(function (error) { // 请求失败处理
  152. alert(error);
  153. });
  154. },
  155. handleDownload(index, row) {
  156. debugger;
  157. // 固定基础URL
  158. const baseUrl = SRMFileUrl;
  159. const QuotationNo = row.Code + row.InvCode + row.BatchCode;
  160. // 拼接下载地址(注意路径格式)
  161. const downloadUrl = `${baseUrl}/File/VendorFile/${row.VenCode}/${QuotationNo}/${row.FileName}`;
  162. // 创建隐藏链接触发下载
  163. const link = document.createElement('a');
  164. link.href = downloadUrl;
  165. link.download = row.FileName; // 设置下载文件名
  166. document.body.appendChild(link);
  167. link.click();
  168. document.body.removeChild(link);
  169. },
  170. initControl: function () {
  171. let that = this;
  172. // let orgName = '';
  173. // this.disabled4RulesCode = this.id ? true : false;
  174. let userName = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserName';
  175. // console.log(userName);
  176. this.getData();
  177. //this.getAllItem();
  178. //this.getAllAql();
  179. },
  180. getData() {
  181. //if (!this.id) return;
  182. axios
  183. .get('/BBWMS/IQCQuality/GetVendorFileList?keyValue=' + this.ASNCode + '&InvCode=' + this.InvCode + '&BatchCode=' + this.BatchCode)
  184. .then(function (res) {
  185. if (res.data) {
  186. res.data.forEach(function (el, i) {
  187. Vue.set(vm.dataSource4File, i, el)
  188. });
  189. }
  190. })
  191. .catch(function (error) { // 请求失败处理
  192. alert(error);
  193. });
  194. },
  195. handleSelectionChange4File(val) {
  196. this.multipleSelection = val;
  197. },
  198. submitCheck() {
  199. //$.submitForm({});
  200. $.currentWindow().$("#gridList").trigger("reloadGrid");
  201. },
  202. },
  203. });
  204. function submitForm() {
  205. //debugger;
  206. vm.submitCheck();
  207. }
  208. </script>